<template>
  <div id="landdetails">  

    <el-form ref="form" :model="form" label-width="80px">  
     <el-row> 

        <el-col :span="20" style="display:flex;">
             <div style="height:38px;line-height:38px;"> 
                  <i class="el-icon-back" @click="goBack"></i> 
                  {{ $route.query.name }} 
                </div>
            <el-form-item label="" label-width="0px" style="margin-left:10px;">
                <el-select  v-model="form.select_num" placeholder="请选择状态" style="width:160px;">
                    <el-option  v-for="(item,index) in select_data" :key="index" :label="item.name" :value="item.id"></el-option>
                </el-select>
            </el-form-item>

           <div class="custom_button2"  style="margin-left:10px;" @click="search_but"></div>
        </el-col>

        <el-col :span="4" style="text-align: right;">  
            <el-button type="primary" class="custom_color_button" style="margin-bottom:10px;" @click="refresh_but()">刷新</el-button>            
          </el-col>
    
    </el-row> 
   
   </el-form>
   <!-- 渲染数据list -->
   <landdetails-list :datalist="datalist" @up_list_fun="list_fun"> </landdetails-list>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>



    

      
  </div>
</template>

<script>
import LanddetailsList from '@/view/Search/LanddetailsList'
export default {
  name: 'landdetails',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,
        my_id:'',
        form:{
          select_num:0
        },
        select_data:[{"id":0,"name":"全部"},{"id":1,"name":"买家"},{"id":2,"name":"卖家"}],
    }
  },
 components:{
    LanddetailsList
  },
  created(){
     this.my_id = this.$route.query.id
     this.list_fun()
  },
  mounted (){
    
  },
  methods: {
      list_fun(){
          this.post("/Statistics/tradeListOfData", {
              page:this.page,
              uid:this.my_id,
              user_type:this.form.select_num
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list

            //console.log(res)
         })
      },
      search_but(){
        this.page = 1
        this.list_fun()
      },
      refresh_but(){
        this.page = 1
        this.form={
          select_num:0
        }
        this.list_fun()
      },
       goBack() {
        this.$router.go(-1)
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
</style>
